<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        
    </style>
</head>
<body>
    
</body>

<script>
function * gen(arg){
    console.log(arg)
    yield 111
    yield 222
    yield 333
}    
//执行获取迭代器对象
let iterator=gen('aaa');
console.log(iterator.next())
//next方法可传入实参
console.log(iterator.next('bbb'))
// console.log(iterator.next())
// console.log(iterator.next())
// console.log(iterator.next())
// console.log(iterator.next())
</script>
</html>